//
//  QTIRWCPSegment.h
//  KyBluetoothPlugin
//
//  Created by ky on 2024/6/25.
//

#import <Foundation/Foundation.h>

/*!
 @header QTIRWCPSegment
 该对象封装了通过 RWCP 发送的命令。
 */

/// @class QTIRWCPSegment 封装一个数据包，其中包含一个帧和一些数据。
@interface QTIRWCPSegment : NSObject

/// @brief 段长
@property (nonatomic, readonly) uint8_t length;
/// @brief 序列号
@property (nonatomic, readonly) uint8_t sequence;
/// @brief 标志或操作码
@property (nonatomic, readonly) uint8_t flags;
/// @brief data
@property (nonatomic,readonly) NSData * _Nullable data;

/*!
 @brief 创建新的分段
 @param length Length of the segment
 @param sequence The sequence number
 @param data The data to send
 */
- (id _Nonnull )initWithLength:(uint8_t)length sequence:(uint8_t)sequence data:(NSData * _Nonnull)data;

- (id _Nonnull)initWithCode:(uint8_t)opCode sequence:(uint8_t)sequence;

- (id _Nonnull)initWithCode:(uint8_t)opCode sequence:(uint8_t)sequence data:(NSData *_Nonnull)data;

@end

